<!DOCTYPE html>

<html lang="zh-cn">

<head>
    <meta charset="utf-8">
    <title>PromiseTest</title>
    <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
</head>

<body>
    <script>
        var promise1 = new Promise(resolve => {
            setTimeout(() => {
                console.log('2s.');
                resolve('promise1');
            }, 2000);
        });

        promise1.then(data => {
            console.log(`${data}, 3s`);
            return new Promise(resolve => {
                setTimeout(() => {
                    console.log('promise2');
                    resolve('promise2');
                }, 3000);
            });
        }).then(data => {
            console.log(`${data},promise3`);
        });
    </script>
</body>

</html>